//
//  EducationTabCell.m
//  GC_OC
//
//  Created by lbh on 2022/4/5.
//

#import "EducationTabCell.h"

@implementation EducationTabCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeUI];
    }
    return self;
}

#pragma mark --Priavte
- (void)makeUI{
    self.backgroundColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(wid(0));
        make.left.mas_equalTo(wid(20));
        make.right.mas_equalTo(-wid(20));
        make.bottom.mas_equalTo(0);
    }];

    [self.bgView addSubview:self.iconImageView];
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(wid(19));
        make.left.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(wid(120), wid(120)));
        make.bottom.mas_equalTo(-wid(19));
    }];
    
    [self.bgView addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-wid(15));
        make.top.mas_equalTo(self.iconImageView.mas_top).offset(0);
    }];
    
    [self.bgView addSubview:self.timeImageView];
    [self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.timeLabel.mas_centerY).offset(0);
//        make.right.mas_equalTo(self.timeLabel.mas_left).offset(-wid(5));
        make.right.mas_equalTo(-45);
        make.size.mas_equalTo(CGSizeMake(wid(30), wid(30)));
    }];
    
    [self.bgView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.iconImageView.mas_top).offset(wid(5));
        make.left.mas_equalTo(self.iconImageView.mas_right).offset(wid(15));
        make.right.mas_equalTo(-wid(110));
    }];
    
    [self.bgView addSubview:self.descLabel];
    [self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(wid(20));
        make.left.mas_equalTo(self.iconImageView.mas_right).offset(wid(15));
        make.right.mas_equalTo(-wid(15));
    }];
    
    [self.bgView addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark --Lazy
- (UIView *)bgView{
    if (!_bgView) {
        _bgView = [[UIView alloc]init];
        _bgView.backgroundColor = [UIColor whiteColor];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 8;
    }
    return _bgView;
}
- (UIImageView *)iconImageView{
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc]init];
        _iconImageView.image = [UIImage imageNamed:@"Logo"];
        _iconImageView.layer.masksToBounds = YES;
        _iconImageView.layer.cornerRadius = 10;
    }
    return _iconImageView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:FontSize(13)];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.text = @"1";
    }
    return _titleLabel;
}
- (UIImageView *)timeImageView{
    if (!_timeImageView) {
        _timeImageView = [[UIImageView alloc]init];
        _timeImageView.image = [UIImage imageNamed:@"time"];
    }
    return _timeImageView;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = [UIFont systemFontOfSize:FontSize(10)];
        _timeLabel.textColor = RBG(150,150,150);
        _timeLabel.text = @"01:00";
    }
    return _timeLabel;
}
- (UILabel *)descLabel{
    if (!_descLabel) {
        _descLabel = [[UILabel alloc]init];
        _descLabel.font = [UIFont systemFontOfSize:FontSize(10)];
        _descLabel.textColor = RBG(163,163,163);
        _descLabel.text = @"教练很好，感觉有效果，教练很好，感觉有效果";
        _descLabel.numberOfLines = 2;
    }
    return _descLabel;
}
- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = RBG(244, 244, 244);
        
    }
    return _lineView;
}
@end


@implementation EducationTitleTabCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeUI];
    }
    return self;
}

#pragma mark --Priavte
- (void)makeUI{
//    self.backgroundColor = RBG(246,247,249);
    
    [self.contentView addSubview:self.bgView];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
    
//    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.top.left.right.bottom.mas_equalTo(0);
//
//    }];

    [self.bgView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bgView.mas_centerY);
        make.left.mas_equalTo(wid(50));
    }];
    
    [self.bgView addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-wid(30));
//        make.centerY.mas_equalTo(self.titleLabel.mas_centerY).offset(0);
        make.top.mas_equalTo(15);
        
    }];
    
    [self.bgView addSubview:self.timeImageView];
    [self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.timeLabel.mas_centerY).offset(0);
//        make.right.mas_equalTo(self.timeLabel.mas_left).offset(-wid(5));
        make.right.mas_equalTo(-70);
        make.size.mas_equalTo(CGSizeMake(wid(30), wid(30)));
    }];
    
    [self.contentView addSubview:self.lineView];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo(wid(20));
        make.right.mas_equalTo(-wid(20));
        make.height.mas_equalTo(1);
    }];
}

#pragma mark --Lazy
- (UIView *)bgView{
    if (!_bgView) {
        _bgView = [[UIView alloc]init];
        _bgView.backgroundColor = [UIColor whiteColor];
//        _bgView.layer.masksToBounds = YES;
//        _bgView.layer.cornerRadius = 8;
    }
    return _bgView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.font = [UIFont systemFontOfSize:17];
        _titleLabel.textColor = [UIColor blackColor];
        _titleLabel.text = @"1";
    }
    return _titleLabel;
}
- (UIImageView *)timeImageView{
    if (!_timeImageView) {
        _timeImageView = [[UIImageView alloc]init];
//        _timeImageView.image = [UIImage imageNamed:@"time"];
        _timeImageView.image = [UIImage imageNamed:@"icon_定时_32_default_white"];
    }
    return _timeImageView;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.font = [UIFont systemFontOfSize:FontSize(14)];
        _timeLabel.textColor = RBG(150,150,150);
        _timeLabel.text = @"01:00";
    }
    return _timeLabel;
}
- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = RBG(244, 244, 244);
        
//        _lineView.backgroundColor = [UIColor blueColor];
    }
    return _lineView;
}
@end
